import fetch from './fetch'

const homeService = {}

/*
  *用户是否注册
 * POST /API/Home/IsRegister
    params={
    "openid":"用户openid"
    }
 */
homeService.IsRegister = function () {
  return fetch({
    url: 'Home/IsRegister',
    method: 'post'
  })
}

/*
  用户注册
  POST /API/Home/Register
  params = {
    "openid":"微信openid",
    "nickname":"昵称",
    "avatar":"头像",
    "sex":"性别: 0.未知 1.男 2.女",
    "province":"省",
    "city":"市",
    "country":"区"
  }
*/
homeService.Register = function (params) {
  return fetch({
    url: 'Home/Register',
    method: 'post',
    data: params
  })
}

/*
  用户登陆
  POST /API/Home/Login
  params={
    "openid":"微信openid"
  }
*/
homeService.Login = function (params) {
  return fetch({
    url: 'Home/Login',
    method: 'POST',
    data: params
  })
}

export default homeService
